function count_same_elements(collection) {
  //在这里写入代码
  let arr=[];
  let result={};
 
  for(let i of collection)
  {
    if(i.length!=1)
    {
      let arr1=i.split("");
      result[i]={};
      result[i].key=arr1[0];
      result[i].count=parseInt(arr1[2]);
    }
    else{
      if(!result[i])
    {
      result[i]={};
      result[i].key=i;
      result[i].count=1;
    }
    else
    result[i].count++;
  }
}
 for(let j in result)
    arr.push(result[j]);
    //console.log(arr);
    
    return arr;
}

module.exports = count_same_elements;
